/*
 * @Description:
 * @Version: 1.0
 * @Author: marshal
 * @Date: 2022-06-20 09:30:27
 * @LastEditors: marshal
 * @LastEditTime: 2022-06-20 10:27:24
 */
#include <stdio.h>
#include <string.h>
#define NAME_LEN 20

// 0. 定义结构体
struct Person0
{
    int age;
    char name[NAME_LEN];
};

// 1. 定义结构体及声明结构体变量
struct Person1
{
    int age;
    char name[NAME_LEN];
} tom, jakc;

// 2. 定义结构体，声明结构体变量并初始化
struct Person2
{
    int age;
    char name[NAME_LEN];
} jhon = {20, "Jhon"};

int main(int argc, char const *argv[])
{

    // 0. 声明结构体变量并赋值
    struct Person0 p = {20, "p"};
    printf("name = %s, age=%d\n", p.name, p.age);
    // 1. 对结构体变量赋值
    tom.age = 10;
    strcpy(tom.name, "Tom");
    printf("name = %s, age=%d\n", tom.name, tom.age);
    return 0;
}
